home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13605 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.0 KB  |  31 lines

  1. Newsgroups: comp.lang.c
  2. Path: gail.ripco.com!mambuhl
  3. From: mambuhl@ripco.com (Martin Ambuhl)
  4. Subject: Re: array[index]         
  5. Message-ID: <DpL12A.DKA@rci.ripco.com>
  6. X-Nntp-Sender: mambuhl@golden.ripco.com
  7. Sender: usenet@rci.ripco.com (Net News Admin)
  8. Organization: Ripco Internet BBS Chicago
  9. Date: Tue, 9 Apr 1996 06:37:20 GMT
  10.  
  11. ftlgeuse@dfw.dfw.net (Azazel Diabolus (aka Fetelgeuse)) in
  12. <4jiies$3bh@fnord.dfw.net> asks:
  13.  
  14. >On my platform's assembly language a[n] is the same as n[a]; is this also
  15. >valid in C? Does array[index] give the same address as index[array]? I
  16. >will try this after I post it but I would like to know if this is
  17. >something defined by the ANSI standard. Thanks,
  18.  
  19. a[n] =>
  20.         *(a+n) == *(n+a)
  21.                         => n[a]
  22.  
  23. From ISO 6.3.2:
  24.         The definition of the subscript operator is that E1[E2] is
  25.         identical to (*(E1+(E2))).
  26.  
  27.                                                                                                   
  28. --
  29. * Martin Ambuhl       net: mambuhl@ripco.com
  30. * Chicago, IL (USA)    
  31.